//@ sourceURL=RiskFactorsView.js
Ext.ns("RiskFactorsView");
RiskFactorsView = Ext.extend(Ext.Panel, {
    constructor : function(a) {
        Ext.applyIf(this, a);
        var all=this.initUIComponents();
        RiskFactorsView.superclass.constructor.call(this, {
            id : "RiskFactorsView",
            title : "职业健康危害因素",
            region : "center",
            layout : "border",
            border : false,
            iconCls : "menu-position",
            items : [all.yearGridPanel,all.yearGridSearchPanel,all.yearGridTreePanel]
        });
    },
    initUIComponents : function() {
        var yearGridComponents=new createyeargridview({
            topbar : {
                inputFormName : 'RiskFactorsForm',
                topbarAdd:{
                    hidden:false
                },
                topbarDel:{
                    hidden:false
                }
            },
            search : {
                items : [ {
                    style : "margin:5px 5px 5px 5px;",
                    text : "因素名称"
                }, {
                    columnWidth : 0.2,
                    xtype : "textfield",
                    name : "Q_factorName_S_LK",
                    maxLength : 256
                } ]
            },
            grid : {
                title : "危害因素列表",
                rowActions:true,
                listUrl : __ctxPath + "/health/listRiskFactors.do",
                removeUrl : __ctxPath + "/health/deleteRiskFactors.do",
                fields : [ "id", 'years', 'factorName','involveDept', "involvePost", "riskLevel","reason","involvePerson","involveTask","involvePosition","controlMeasures","emergency"],
                columns : [ {
                    header : "id",
                    dataIndex : "id",
                    hidden : true
                }, {
                    header : "年份",
                    dataIndex : "years",
                    hidden : true,
                    sortable : true
                },{
                    header : "因素名称",
                    dataIndex : "factorName",
                    width : 70
                },{
                    header : "涉及部门",
                    dataIndex : "involveDept",
                    width : 80
                },{
                    header : "涉及岗位",
                    dataIndex : "involvePost",
                    width : 70
                },{
                    header : "风险等级",
                    dataIndex : "riskLevel",
                    width : 70
                },{
                    header : "出现原因",
                    dataIndex : "reason",
                    width : 70
                },{
                    header : "涉及人员或岗位",
                    dataIndex : "involvePerson",
                    width : 70
                },{
                    header : "监测",
                    dataIndex : "id",
                    width : 50,
                    renderer : function(j, i, g, m, h) {
                        var cfg={
                                riskFactorsId : g.data.id
                        }
                        var k = "";
                                k += '<button title="监测" value="" class="btn-showDetail" onclick=\'RiskFactorsView.monitor('
                                    + JSON.stringify(cfg) + ')\'></button>';
                        return k;
                    }
                },{
                    header : "评审",
                    dataIndex : "id",
                    width : 50,
                    renderer : function(j, i, g, m, h) {
                        var cfg={
                                riskFactorsNo : g.data.id
                        }
                        var k = "";
                                k += '<button title="评审" value="" class="btn-showDetail" onclick=\'RiskFactorsView.review('
                                    + JSON.stringify(cfg) + ')\'></button>';
                        return k;
                    }
                }
            ]
            },
            tree : {
                treeUrl : __ctxPath + "/health/treeLoadRiskFactors.do"
            }
            
        });
        return yearGridComponents;
    }
});
RiskFactorsView.monitor = function(riskFactors){
    new MonitorWindow({
        riskFactorsId : riskFactors.riskFactorsId
    }).show();
};

RiskFactorsView.review = function(riskFactors){
    new ReviewWindow({
        riskFactorsNo : riskFactors.riskFactorsNo
    }).show();
};

